package edu.ccut.saturn.manager.menu.impl;

import java.util.List;

import edu.ccut.saturn.component.DefaultComponent;
import edu.ccut.saturn.component.IMuneItemInfo;
import edu.ccut.saturn.component.IParameterContext;
import edu.ccut.saturn.component.SaturnMenuManager;

public class GetChildMenuList extends DefaultComponent {
	@Override
	public void execute(IParameterContext parameterContext) throws Exception {

		String id = (String) parameterContext.getParameterValue(0);
	//	String symbolicName = (String) parameterContext.getParameterValue(1);
	//	String menuType = (String) parameterContext.getParameterValue(2);

/*		if (id == null) {

		}
		if (symbolicName == null) {

		}*/
		List<IMuneItemInfo> childMenuItemList = SaturnMenuManager.getInstance()
				.getMenuItemsOfRootMenuItem(id);
/*
		if (menuType != null && menuType.equals("child")) {
			List<IMuneItemInfo> menuItems = SaturnMenuManager.getInstance()
					.getAllMenuItemInfos();

			String parentId = "";
			
			for (IMuneItemInfo menuItem : menuItems) {
				if (menuItem.getId().equals(id)&& menuItem.getMenuInfo().getBundleSymbolicName().equals(symbolicName)) {
					parentId = menuItem.getParentId();
					break;
				}
			}
			
			if (!"".equals(parentId)) {
				childMenuItemList = SaturnMenuManager.getInstance()
						.getMenuItemsOfRootMenuItem(parentId);
			}
		}*/

		parameterContext.setParameter(3, childMenuItemList);
	}
}